package org.example.aop_demo1.controller;


import org.example.aop_demo1.entity.User;
import org.example.aop_demo1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    @GetMapping("/getById")
    public User getUser(String id,String name) {
        System.out.println(id);
        User user = new User("ytt",12,"山东");
        return user;
    }

    @PostMapping("/save")
    public User saveUser(@RequestBody User user) {

        return  userService.saveUser(user);
    }
}
